﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Happy.Examples.OrderManagement.Domain.Orders;

namespace Happy.Examples.OrderManagement.Domain.Test.Orders
{
    [TestClass]
    public class OrderInAuditingStateTest
    {
        [TestMethod]
        public void Order_In_AuditingState_Test()
        {
            var order = TestHelper.CreateOrderInAuditingState();

            Assert.AreEqual(OrderStatus.Auditing, order.Status);
        }

        [TestMethod]
        [ExpectedException(typeof(InvalidOperationException))]
        public void Order_In_AuditingState_ChangeOrder_Test()
        {
            var order = TestHelper.CreateOrderInAuditingState();

            order.ChangeCustomerInfo(TestHelper.StubCustomerInfos["Jack"]);
        }

        [TestMethod]
        public void Order_In_AuditingState_Save_Test()
        {
            var order = TestHelper.CreateOrderInAuditingState();

            order.Save();
        }

        [TestMethod]
        [ExpectedException(typeof(InvalidOperationException))]
        public void Order_In_AuditingState_Submit_Test()
        {
            var order = TestHelper.CreateOrderInAuditingState();

            order.Submit();
        }

        [TestMethod]
        public void Order_In_AuditingState_Audit_Test()
        {
            var order = TestHelper.CreateOrderInAuditingState();

            order.Audit();
        }
    }
}
